package service

import (
	"context"
	"demo01/internal/biz"
	"fmt"

	pb "demo01/api/helloworld/v1"
)

type DemoService struct {
	pb.UnimplementedDemoServer
	du *biz.DemoUser
}

func NewDemoService(du *biz.DemoUser) *DemoService {
	return &DemoService{
		du: du,
	}
}

func (s *DemoService) CreateDemo(ctx context.Context, req *pb.CreateDemoRequest) (*pb.CreateDemoReply, error) {
	fmt.Println(req.Name)
	return &pb.CreateDemoReply{
		Message: "hello",
	}, nil
}
func (s *DemoService) UpdateDemo(ctx context.Context, req *pb.UpdateDemoRequest) (*pb.UpdateDemoReply, error) {
	return &pb.UpdateDemoReply{}, nil
}
func (s *DemoService) DeleteDemo(ctx context.Context, req *pb.DeleteDemoRequest) (*pb.DeleteDemoReply, error) {
	return &pb.DeleteDemoReply{}, nil
}
func (s *DemoService) GetDemo(ctx context.Context, req *pb.GetDemoRequest) (*pb.GetDemoReply, error) {
	fmt.Println(req.Name)
	return &pb.GetDemoReply{Message: fmt.Sprintf("hello: %s", req.Name)}, nil
}
func (s *DemoService) ListDemo(ctx context.Context, req *pb.ListDemoRequest) (*pb.ListDemoReply, error) {
	return &pb.ListDemoReply{}, nil
}
